package com.cnsoft.player.game;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.cnsoft.framework.beans.common.RESTResultBean;
import org.cnsoft.framework.beans.user.LoginerBean;
import org.cnsoft.framework.beans.user.UserBean;
import org.cnsoft.framework.support.MyTokenCommonSupport;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.cnsoft.material.IMaterialConstants;

/**
 * 列表页面接口
 * 
 * @version 1.0.0 2014/11/19
 * @since 1.0.0 2014/11/19
 */
@Controller
//@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
@RequestMapping(value = "/game/1.0/player")
public class GamePlayerLoginApiController extends MyTokenCommonSupport implements IMaterialConstants {

	@Resource
	private GamePlayerLoginService myPlayerLoginService;

	/**
	 * 玩家登录
	 */
	@RequestMapping(value = "/login.js", method = RequestMethod.POST)
	@ResponseBody
	public RESTResultBean<UserBean> doPlayerLogin(HttpServletRequest request, HttpServletResponse response, String token, LoginerBean loginer) throws Exception {
		return myPlayerLoginService.doLogin(request, response, loginer);
	}
	
	/**获得临时Token*/
	@RequestMapping(value = "/loading.js", method = RequestMethod.POST)
	@ResponseBody
	public RESTResultBean<UserBean> doPlayerLoading(HttpServletRequest request, HttpServletResponse response, String sid, LoginerBean gameid) throws Exception {
		return myPlayerLoginService.doLoading(request, response, sid,gameid);
	}
}
